package edu.infomatik.tundra.model;

import org.apache.tapestry5.ValueEncoder;

import edu.infomatik.tundra.data.DAOtundra;
import edu.infomatik.tundra.logic.SprintBean;

public class SprintIdEncoder implements ValueEncoder<SprintBean> {

	@Override
	public String toClient(SprintBean value) {
		return ""+value.getId();
	}

	@Override
	public SprintBean toValue(String clientValue) {
		if (null!=clientValue){
			SprintBean sb = new SprintBean();
			sb.setId(Long.parseLong(clientValue));
			return (SprintBean)DAOtundra.getInstance().getBeanById(sb);
		}
		return new SprintBean();
	}

}
